#include <iostream>

using namespace std;
#include"direcror.h"
#include"concretebuilder.h"
#ifndef SAFE_DELETE
#define SAFE_DELETE(p) { if(p){delete(p); (p)=NULL;} }
#endif
int main()
{
    //建造者模式
    Direcror *pDirecror=new Direcror();

    IBuilder *pBuilder=new TCLPhoneBuilder;
    pDirecror->Create(pBuilder);
    Phone *pPhone=pBuilder->GetPhone();
    cout<<"TCL Batter:"<<pPhone->GetBattery()<<endl;
    cout<<"TCL Scree:"<<pPhone->GetScreen()<<endl;

    pBuilder=new LGPhoneBuilder;
    pDirecror->Create(pBuilder);
    pPhone=pBuilder->GetPhone();
    cout<<"LG Batter:"<<pPhone->GetBattery()<<endl;
    cout<<"LG Scree:"<<pPhone->GetScreen()<<endl;

    pBuilder=new HuaWeiPhoneBuilder;
    pDirecror->Create(pBuilder);
    pPhone=pBuilder->GetPhone();
    cout<<"LG Batter:"<<pPhone->GetBattery()<<endl;
    cout<<"LG Scree:"<<pPhone->GetScreen()<<endl;

    SAFE_DELETE(pDirecror);
    SAFE_DELETE(pBuilder);
    SAFE_DELETE(pPhone);

    return 0;
}
